home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWBmpShp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.2 KB  |  170 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWBmpShp.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWBMPSHP_H
  11. #define FWBMPSHP_H
  12.  
  13. #ifndef FWBNDSHP_H
  14. #include "FWBndShp.h"
  15. #endif
  16.  
  17. #ifndef FWBITMAP_H
  18. #include "FWBitmap.h"
  19. #endif
  20.  
  21. //========================================================================================
  22. //    Forward Declarations
  23. //========================================================================================
  24.  
  25. class FW_CGraphicContext;
  26.  
  27. //========================================================================================
  28. //    class FW_CBitmapShape
  29. //========================================================================================
  30.  
  31. class FW_CBitmapShape : public FW_CBoundedShape
  32. {
  33. public:
  34.     FW_DECLARE_CLASS
  35.     FW_DECLARE_AUTO(FW_CBitmapShape)
  36.  
  37. //----------------------------------------------------------------------------------------
  38. //    Constructors/Destructors
  39. //
  40. public:
  41.     FW_CBitmapShape(FW_CBitmap bitmap, const FW_CRect& dstRect);
  42.     FW_CBitmapShape(FW_CBitmap bitmap, const FW_CRect& srcRect, const FW_CRect& dstRect);
  43.  
  44.     FW_CBitmapShape(const FW_CBitmapShape& other);
  45.     FW_CBitmapShape(FW_CReadableStream& stream);
  46.  
  47.     virtual ~FW_CBitmapShape();
  48.     
  49. //----------------------------------------------------------------------------------------
  50. //    Operators
  51. //
  52. public:
  53.     FW_CBitmapShape& operator=(const FW_CBitmapShape& other);
  54.     
  55. //---------------------------------------------------------------------------------------
  56. //    Inherited API
  57. //
  58. public:
  59.     // ----- Rendering -----
  60.     virtual void             Render(FW_CGraphicContext& gc) const;
  61.     
  62.     // ----- Flatten -----
  63.     virtual void            Flatten(FW_CWritableStream& stream) const;
  64.  
  65. //---------------------------------------------------------------------------------------
  66. //    New API
  67. //
  68. public:
  69.     // ----- Rendering -----
  70.     static void            RenderBitmap(FW_CGraphicContext& gc,
  71.                                         FW_CBitmap bitmap,
  72.                                         const FW_CRect& srcRect,
  73.                                         const FW_CRect& dstRect,
  74.                                         const FW_CInk& ink = FW_kNormalInk);
  75.     static void            RenderBitmap(FW_CGraphicContext& gc,
  76.                                         FW_CBitmap bitmap,
  77.                                         const FW_CRect& dstRect,
  78.                                         const FW_CInk& ink = FW_kNormalInk);
  79.     
  80.     // ----- Copying -----
  81.     virtual FW_CShape*        Copy() const;
  82.                                     
  83.     // ----- Archiving -----
  84.     static void*             Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  85.  
  86.     // ----- Geometry -----
  87.     void                    SetGeometry(const FW_CBitmap& bitmap, 
  88.                                 const FW_CRect& srcRect, 
  89.                                 const FW_CRect& dstRect);
  90.                                 
  91.     void                     GetGeometry(FW_CBitmap& bitmap, 
  92.                                 FW_CRect& srcRect, 
  93.                                 FW_CRect& dstRect) const;
  94.  
  95.     void                    SetSourceRect(const FW_CRect& srcRect);
  96.     void                    GetSourceRect(FW_CRect& srcRect) const;
  97.     
  98.     void                    SetDestinationRect(const FW_CRect& destinationRect);
  99.     void                    GetDestinationRect(FW_CRect& destinationRect) const;
  100.  
  101.     FW_CBitmap                 GetBitmap() const;    
  102.     void                     SetBitmap(const FW_CBitmap& bitmap);
  103.  
  104. //---------------------------------------------------------------------------------------
  105. //    Data Members
  106. //
  107. private:
  108.     FW_CRect            fSrcRect;
  109.     FW_CBitmap            fBitmap;
  110. };
  111.  
  112. //========================================================================================
  113. //    Inlines
  114. //========================================================================================
  115.  
  116. //---------------------------------------------------------------------------------------
  117. //    FW_CBitmapShape::SetSourceRect
  118. //---------------------------------------------------------------------------------------
  119.  
  120. inline void FW_CBitmapShape::SetSourceRect(const FW_CRect& srcRect)
  121. {
  122.     fSrcRect = srcRect;
  123. }
  124.  
  125. //---------------------------------------------------------------------------------------
  126. //    FW_CBitmapShape::GetSourceRect
  127. //---------------------------------------------------------------------------------------
  128.  
  129. inline void FW_CBitmapShape::GetSourceRect(FW_CRect& srcRect) const
  130. {
  131.     srcRect = fSrcRect;
  132. }
  133.  
  134. //---------------------------------------------------------------------------------------
  135. //    FW_CBitmapShape::GetDestinationRect
  136. //---------------------------------------------------------------------------------------
  137. inline void FW_CBitmapShape::GetDestinationRect(FW_CRect& dstRect) const
  138. {
  139.     dstRect = fRect;
  140. }
  141.  
  142. //---------------------------------------------------------------------------------------
  143. //    FW_CBitmapShape::SetDestinationRect
  144. //---------------------------------------------------------------------------------------
  145.  
  146. inline void FW_CBitmapShape::SetDestinationRect(const FW_CRect& dstRect)
  147. {
  148.     fRect = dstRect;
  149. }
  150.  
  151. //---------------------------------------------------------------------------------------
  152. //    FW_CBitmapShape::GetBitmap
  153. //---------------------------------------------------------------------------------------
  154.  
  155. inline FW_CBitmap FW_CBitmapShape::GetBitmap() const
  156. {
  157.     return fBitmap;
  158. }
  159.  
  160. //---------------------------------------------------------------------------------------
  161. //    FW_CBitmapShape::SetBitmap
  162. //---------------------------------------------------------------------------------------
  163.  
  164. inline void FW_CBitmapShape::SetBitmap(const FW_CBitmap& bitmap)
  165. {
  166.     fBitmap = bitmap;
  167. }
  168.                 
  169. #endif
  170.